//
//  TDPieChart.h
//  iosf
//
//  Created by Ye Yuan on 12-4-2.
//  Copyright (c) 2012年 Neusoft Corporation. All rights reserved.
//

#import <UIKit/UIKit.h>

@class TDPieChart;

#pragma mark - TDPieChart Data Source Protocol

@protocol TDPieChartDataSource <NSObject>
@required
- (NSUInteger)numberOfSlicesInPieChart:(TDPieChart *)pieChart;
- (CGFloat)pieChart:(TDPieChart *)pieChart valueForSliceAtIndex:(NSUInteger)index;
@optional
- (UIColor *)pieChart:(TDPieChart *)pieChart colorForSliceAtIndex:(NSUInteger)index;
@end

#pragma mark - TDPieChart Delegate Protocol

@protocol TDPieChartDelegate <NSObject>
@optional
- (void)pieChart:(TDPieChart *)pieChart willSelectSliceAtIndex:(NSUInteger)index;
- (void)pieChart:(TDPieChart *)pieChart didSelectSliceAtIndex:(NSUInteger)index;
- (void)pieChart:(TDPieChart *)pieChart willDeselectSliceAtIndex:(NSUInteger)index;
- (void)pieChart:(TDPieChart *)pieChart didDeselectSliceAtIndex:(NSUInteger)index;
@end

#pragma mark - TDPieChart 

@interface TDPieChart : UIView
@property(nonatomic, weak) id<TDPieChartDataSource> dataSource;
@property(nonatomic, weak) id<TDPieChartDelegate> delegate;
@property(nonatomic, assign) CGFloat startPieAngle;
@property(nonatomic, assign) CGFloat animationSpeed;
@property(nonatomic, assign) CGPoint pieCenter;
@property(nonatomic, assign) CGFloat pieRadius;
@property(nonatomic, assign) BOOL    showLabel;
@property(nonatomic, strong) UIFont  *labelFont;
@property(nonatomic, assign) CGFloat labelRadius;
@property(nonatomic, assign) CGFloat selectedSliceStroke;
@property(nonatomic, assign) CGFloat selectedSliceOffsetRadius;
@property(nonatomic, assign) BOOL    showPercentage;
- (id)initWithFrame:(CGRect)frame Center:(CGPoint)center Radius:(CGFloat)radius;
- (void)reloadData;
- (void)setPieBackgroundColor:(UIColor *)color;
@end;
